package com.yexiao.cofe.business.pojo;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.annotation.*;
import com.yexiao.core.util.JSONUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 参数模板
 * 一个参数模板可以绑定多个参数
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@TableName("param_template")
public class ParamTemplate {

    /**
     * 模板ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 门店ID
     */
    @TableField("store_id")
    private String storeId;

    /**
     * 模板名称
     */
    @TableField("name")
    private String name;

    /**
     * 模板描述
     */
    @TableField("description")
    private String description;

    public static final String ID = "id";
    public static final String STORE_ID = "store_id";
    public static final String NAME = "name";
    public static final String DESCRIPTION = "description";

    public ParamTemplate(String storeId, String name, String description) {
        this.storeId = storeId;
        this.name = name;
        this.description = description;
    }

    public static JSONObject getBaseMsg(ParamTemplate paramTemplate) {
        return JSONUtil.of(
                "id", paramTemplate.getId(),
                "name", paramTemplate.getName(),
                "description", paramTemplate.getDescription(),
                "storeId", paramTemplate.getStoreId()
        );
    }
}
